Skip to content

feat: Set the segment source on the scope for NoOpStreamedSpan - #7163

Merged
alexander-alderman-webb merged 21 commits into
masterfrom
webb/set-segment-source-on-scope
Aug 12, 2026
Merged

feat: Set the segment source on the scope for NoOpStreamedSpan#7163
alexander-alderman-webb merged 21 commits into
masterfrom
webb/set-segment-source-on-scope

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Add the attributes parameter to NoOpStreamedSpan.__init__() and set only the sentry.segment.name.source attribute when provided.

Set the segment source when a segment NoOpStreamedSpan is set on the scope.

Issues

Reminders

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

104531 passed | ⏭️ 6677 skipped | Total: 111208 | Pass Rate: 94% | Execution Time: 362m 6s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 73.33%. Project has 2481 uncovered lines.
✅ Project coverage is 90.15%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
sentry_sdk/traces.py 60.00% ⚠️ 4 Missing
sentry_sdk/scope.py 100.00% ⚠️ 2 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    90.14%    90.15%    +0.01%
==========================================
  Files          193       193         —
  Lines        25187     25198       +11
  Branches      9178      9190       +12
==========================================
+ Hits         22704     22717       +13
- Misses        2483      2481        -2
- Partials      1430      1433        +3

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb changed the base branch from webb/set-transaction-on-scope to webb/remove-set-transaction-name-early-return August 11, 2026 09:57
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review August 11, 2026 11:11
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner August 11, 2026 11:12
Comment thread sentry_sdk/traces.py Outdated
class NoOpStreamedSpan(StreamedSpan):
__slots__ = (
"_noop_name",
"_segment_source",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we directly access the segment attributes to get the source instead of adding a new slot? Right now it's a bit of a hybrid -- I'd either do it exclusively via attributes or exclusively via the new slot, but not both. (Preferring the attributes approach to avoid adding a slot and keeping source handling consistent in StreamedSpan vs NoOpStreamedSpan.)

@alexander-alderman-webb alexander-alderman-webb Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used _attributes now but only store the sentry.segment.name.source attribute to avoid unnecessary pre-serialization.

Comment thread sentry_sdk/traces.py Outdated
Comment thread sentry_sdk/traces.py Outdated
Base automatically changed from webb/remove-set-transaction-name-early-return to master August 12, 2026 09:01
@alexander-alderman-webb alexander-alderman-webb changed the title feat: Set segment source on scope for NoOpStreamedSpan feat: Set the segment source on the scope for NoOpStreamedSpan Aug 12, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8101f7f. Configure here.

Comment thread sentry_sdk/traces.py
@alexander-alderman-webb
alexander-alderman-webb merged commit 8e18c44 into master Aug 12, 2026
144 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/set-segment-source-on-scope branch August 12, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants